//
//  PublicConstant.h
//  StatisticsData
//
//  Created by zhaochengfeng on 2016/12/26.
//  Copyright © 2016年 bmwl. All rights reserved.
//

#ifndef PublicConstant_h
#define PublicConstant_h


#define iPhone_Device ((BOOL)[[[UIDevice currentDevice] model] isEqualToString:@"iPhone"])

#define kScreenWidth                ([UIScreen mainScreen].bounds.size.width)
#define kScreenHeight               ([UIScreen mainScreen].bounds.size.height)
#define kScreenBounds               ([UIScreen mainScreen].bounds)
#define kWindow                      HCApplication.keyWindow
#define HCApplication  [UIApplication sharedApplication]
#define scaleOfWidth [[UIScreen mainScreen] bounds].size.width / 750
#define scaleOfHeight [[UIScreen mainScreen] bounds].size.height/1334
#define scaleOfWidthSeat [[UIScreen mainScreen] bounds].size.width / 375

#define kTabBarHight self.tabBarController.tabBar.height
/*
 iPhone6 分辨率 750*1334
 */
#define ALD(x)                      ((x) * kScreenWidth/750.0)
#define ALDHeight(y)                ((y) * kScreenHeight/1334.0)

#define kTabbarWidtn  (kScreenWidth)
#define kStatusBarHeight [HCApplication statusBarFrame].size.height

#define kNavigationBarHeight 44.f
#define StatusbarSize ((ISIOS7 && __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1)?20.f:0.f)
#define kUpSpare ((kStatusBarHeight)+(kNavigationBarHeight))
#define kTabBarHeight   49.0f
/*
 间隔
 */
#define kSpaceHeight 24.f

//角度转弧度
#define DegreesToRadians(degrees) (degrees * M_PI / 180)
//弧度转角度
#define RadiansToDegrees(radians) (radians * 180/M_PI)
/*
 self 弱引用
 */
#define __DEFINE_WEAK_SELF __weak __typeof(&*self) weakSelf = self;
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;

/**
 *  系统判断
 */
#define SystemVersionGreaterOrEqualThan(version) ([[[UIDevice currentDevice] systemVersion] floatValue] >= version)
//系统是否为ios5以上
#define ISIOS5 !([[[UIDevice currentDevice] systemVersion] floatValue] <= 4.9f)
//系统是否为ios6以上
#define ISIOS6 !([[[UIDevice currentDevice] systemVersion] floatValue] <= 5.9f)
//系统是否为ios7以上
#define ISIOS7 !([[[UIDevice currentDevice] systemVersion] floatValue] <= 6.9f)
//系统是否为ios8以上
#define ISIOS8 !([[[UIDevice currentDevice] systemVersion] floatValue] <= 7.9f)
//系统是否为ios9以上
#define ISIOS9 !([[[UIDevice currentDevice] systemVersion] floatValue] <= 8.9f)
//系统是否为ios10以上
#define ISIOS10 !([[[UIDevice currentDevice] systemVersion] floatValue] <= 9.9f)

/**
 *  设备判断
 */
#define ISiPhone4S ([UIScreen mainScreen].bounds.size.height == 480.0)
#define ISiPhone5 ([UIScreen mainScreen].bounds.size.height == 568.0)
#define ISiPhone6 ([UIScreen mainScreen].bounds.size.width == 375.0)
#define ISiPhone6Plus ([UIScreen mainScreen].bounds.size.width == 414.0)
/**
 *  自动提示宏
 */
#define HCAutoAttr(objc,kPath) @(((void)objc.kPath,#kPath))
/**
 * 偏好设置
 */
#define HCUserDefaults [NSUserDefaults standardUserDefaults]
/**
 *  偏好设置取值
 */
#define HCUserDefaultsValueForKey(key)  [HCUserDefaults valueForKey:key]
/**
 *  偏好设置清除数据
 */
#define HCUserDefaultsCleanForKey(key) [HCUserDefaults removeObjectForKey:key]
/**
 *  沙盒文件
 */
#define   kPathOfDocument                          [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
#define   kPathOfCache     [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]
/**
 *  项目占位图
 */
#define kHeadPlaceholderImage   [UIImage imageNamed:@"placeHolder"]
//2:1默认图
#define kDefaultPlaceholderBig   [UIImage imageNamed:@"placeholder2_1"]
//4:3默认图
#define kDefaultPlaceholderSmall   [UIImage imageNamed:@"placeholder4_3"]
//圆形默认图
#define kDefaultPlaceholderCircle   [UIImage imageNamed:@"placeholderyuan"]


/**
 *  城市列表缓存时间戳
 */
#define kCityListCacheTime [HCUserDefaults objectForKey:@"CityListCacheTime"]
#define kSetCityListCacheTime(string) [HCUserDefaults setObject:string forKey:@"CityListCacheTime"];

#define kCityList @"CityList"

#define KCheckStr(_STR) ([_STR isEqual:[NSNull null]] || _STR == nil) ? @"" : _STR

#endif /* PublicConstant_h */
